package demo.letcode.top100;

/**
 * 输入 babad
 * 输出bab
 * <p>
 * 输入cbbd
 * 输出bb
 *
 * @author taqo
 * @date 2021/5/7
 */
public class _回文数 {
    public static void main(String[] args) {
        String s = "abcsba";

        System.out.println(hui_wen(s));
    }

    private static boolean hui_wen(String s) {
        int start = 0;
        int end = s.length() - 1;
        while (start < end) {
            char left = s.charAt(start);
            char right = s.charAt(end);
            if (left != right) {
                return false;
            }
            start++;
            end--;
        }
        return true;
    }

}
